//
//  ViewController.m
//  CustomNavigationController
//
//  Created by huangsongyao on 17/2/13.
//  Copyright © 2017年 huangsongyao. All rights reserved.
//

#import "ViewController.h"
#import "BViewController.h"
#import "UIView+Bezier.h"
#import "MacroFaile.h"
#import "HSYCustomMessageView.h"
#import "HSYCustomArcView.h"
#import "HSYCustomProgressView.h"

@interface ViewController ()

@property (nonatomic, strong) HSYCustomArcView *arcView;
@property (nonatomic, strong) HSYCustomProgressView *progressView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *push = [UIButton buttonWithType:UIButtonTypeCustom];
    [push setTitle:@"push" forState:UIControlStateNormal];
    [push setTitle:@"push" forState:UIControlStateHighlighted];
    [push setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [push setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
    [push addTarget:self action:@selector(push:) forControlEvents:UIControlEventTouchUpInside];
    push.frame = CGRectMake(100, 100, 100, 50);
    
    [self.view addSubview:push];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTitle:@"button" forState:UIControlStateNormal];
    [button setTitle:@"button" forState:UIControlStateHighlighted];
    [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [button setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
    [button addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];
    button.frame = CGRectMake(100, CGRectGetMaxY(push.frame) + 100, 100, 50);
    
    [self.view addSubview:button];
    
    //    [self.view bezierForRectangleByRect:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 100) rectangleColor:[UIColor redColor]];
    //    [self.view bezierForRectangleByRect:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 100) rectangleStrokeColor:[UIColor redColor] rectangleLineWidth:5.0f];
    
    //    [self.view bezierForRectangleByRoundedRect:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 100) cornerRadius:10.0f rectangleColor:[UIColor redColor]];
    //    [self.view bezierForRectangleByRoundedRect:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 100) cornerRadius:10.0f rectangleStrokeColor:[UIColor redColor] rectangleLineWidth:10.0f];
    
    //    [self.view bezierForRectangleByRoundedRect:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 100) roundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadius:25 rectangleColor:[UIColor redColor]];
    //    [self.view bezierForRectangleByRoundedRect:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 100) roundingCorners:UIRectCornerTopLeft cornerRadius:25 rectangleStrokeColor:[UIColor redColor] rectangleLineWidth:10.0f];
    
    //    [self.view bezierForOvalInRect:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 100) roundColor:[UIColor redColor]];
    //    [self.view bezierForOvalInRect:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 100) roundStrokeColor:[UIColor redColor] roundLineWidth:10.0f];
    
    //    [self.view bezierClockwiseForArcCenter:self.view.center arcRadius:50 arcStartAngle:0 arcEndAngle:M_PI_2 arcFillColor:[UIColor redColor] arcLineWidth:10.0f];
    
    
    //    [self.view bezierForCurvesByStartPoint:CGPointMake(100, CGRectGetMaxY(push.frame) + 50) endPoint:CGPointMake(200, CGRectGetMaxY(push.frame) + 50) controlPoint:CGPointMake(50, 100) curvesStrokeColor:[UIColor redColor] curvesLineWidth:5.0f];
    //    CGPoint startPoint = CGPointMake(100, CGRectGetMaxY(push.frame) + 50);
    //    CGPoint endPoint = CGPointMake(300, CGRectGetMaxY(push.frame) + 50);
    //    [self.view bezierForCurvesByStartPoint:startPoint
    //                                  endPoint:endPoint
    //                             controlPoint1:CGPointMake(((endPoint.x - startPoint.x)/4 + startPoint.x/2*3), startPoint.y - (endPoint.x - startPoint.x)*2/4)
    //                             controlPoint2:CGPointMake(((endPoint.x - startPoint.x)/4*3 + startPoint.x/2), startPoint.y + (endPoint.x - startPoint.x)*2/4)
    //                         curvesStrokeColor:[UIColor redColor]
    //                           curvesLineWidth:5.0f];
    
    self.arcView = [HSYCustomArcView showArcViewByPropertyParams:@{
                                                                   @(kCustomArcViewForPropertyTypeFillColor) : [UIColor redColor],
                                                                   @(kCustomArcViewForPropertyTypeStrokeColor) : [UIColor greenColor],
                                                                   @(kCustomArcViewForPropertyTypeLineWidth) : @(8.0f),
                                                                   }
                                                           frame:CGRectMake(100, CGRectGetMaxY(button.frame) + 50, 200, 200)
                                                      showInView:self.view];
//    self.arcView.progress = 0.25f;
    
    self.progressView = [[HSYCustomProgressView alloc] initWithFrame:CGRectMake(100, CGRectGetMaxY(push.frame) + 50, 100, 10.0f)];
    self.progressView.fillColor = [[UIColor grayColor] colorWithAlphaComponent:0.8];
    [self.view addSubview:self.progressView];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)button:(id)sender
{
//    [HSYCustomMessageView showMessageViewInView:self.view byPropertyParams:@{
//                                                                             @(kHSYCustomMessagePropertyTypeDataSource) : @[@"0",@"1",@"2",@"3",@"4",@"5",@"6"],
//                                                                             @(kHSYCustomMessagePropertyTypeAnimationDirection)  : @(kHSYCustomMessageAnimationDirectionTypeBottomLeft),
//                                                                             @(kHSYCustomMessagePropertyTypeRaduis) : @(8.0f),
//                                                                             @(kHSYCustomMessagePropertyTypeBgColor) : [UIColor greenColor],
//                                                                             }
//                        didSelectRowAtIndexPath:^(id x, NSIndexPath *indexPath) {
//                            
//                        } removeDidMessage:^{
//                            
//                        } completed:^(BOOL finished) {
//                            
//                        }];
    
    CGFloat progress = 0.75f;
    self.arcView.progress = progress;
    self.progressView.progress = progress;
    
}

- (void)push:(id)sender
{
//    BViewController *vc = [[BViewController alloc] init];
    ViewController *vc = [[ViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
